package com.wangzhixuan.service.impl;

import java.util.List;
import java.util.Map;

import com.wangzhixuan.commons.utils.PageInfo;
import com.wangzhixuan.model.History;
import com.wangzhixuan.mapper.HistoryMapper;
import com.wangzhixuan.service.IHistoryService;
import com.baomidou.mybatisplus.plugins.Page;

import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhixuan.wang
 * @since 2017-08-22
 */
@Service
public class HistoryServiceImpl extends ServiceImpl<HistoryMapper, History> implements IHistoryService {
	
	@Autowired
    private HistoryMapper historyMapper;
    
	@Override
    public void selectDataGrid(PageInfo pageInfo) {
    	Page<Map<String, Object>> page = new Page<Map<String, Object>>(pageInfo.getNowpage(), pageInfo.getSize());
        page.setOrderByField(pageInfo.getSort());
        page.setAsc(pageInfo.getOrder().equalsIgnoreCase("asc"));
        List<History> list = historyMapper.selectHistoryPage(page, pageInfo.getCondition());
        pageInfo.setRows(list);
        pageInfo.setTotal(page.getTotal());
    }

	@Override
	public Integer selectHistoryFid(Integer fileId) {
		Integer id = historyMapper.selectHistoryFid(fileId);
		return id;
	}
}
